package com.ljf.util;

import lombok.Data;
import org.springframework.http.HttpStatus;

@Data
public class Result<T> {
    private int code;
    private String msg;

    private T data;
    public Result(){

    }
    public Result(int code,String msg,T data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> Result success(T data){
        return new Result(200,"成功",data);
    }

    public static <T> Result success(){
        return new Result(200,"成功",null);
    }
    public static <T> Result fail(){
        return new Result(0,"失败",null);
    }
    public static <T> Result fail(int code,String msg){
        return new Result(code,msg,null);
    }
}
